package com.peycard.business;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.ejb.Local;
import javax.ejb.Stateless;

import com.peycard.business.local.DateServiceLocal;
import com.peycard.common.util.Constantes;

/**
 * Session Bean implementation class TokenService
 */
@Stateless
@Local(DateServiceLocal.class)
public class DateService implements DateServiceLocal {

    public static Date date= new Date();
    private SimpleDateFormat sdfMMddHHmmss;
    
    public DateService(){
    	sdfMMddHHmmss = new SimpleDateFormat(Constantes.SIMPLE_DATE_FORMAT_PATTERN_sdfMMddHHmmss);
    }
    
    
    
	@Override
	public Timestamp getDate() {
		return new Timestamp(date.getTime());
	}
	
	public Timestamp generateDateExpirate() {		             
        Timestamp t=new Timestamp(date.getTime() + 600000);
        return t;
	}
	
	public Timestamp getDateExpirateTryLogin() {		             
        Timestamp t=new Timestamp(date.getTime() - 1800000);
        return t;
	}
}
